export default {
  setToken(token) {
    sessionStorage.setItem("bearer_token", token);
  },
  getToken() {
    let token = sessionStorage.getItem("bearer_token");
    return token || "";
  },
  clearToken() {
    sessionStorage.setItem("bearer_token", "");
  },
  getUrlParam(paraName, url) {
    let arrObj = url.split("?");

    if (arrObj.length > 1) {
      let arrPara = arrObj[1].split("&");
      let arr;

      for (let i = 0; i < arrPara.length; i++) {
        arr = arrPara[i].split("=");

        if (arr != null && arr[0] == paraName) {
          return arr[1];
        }
      }
      return "";
    } else {
      return "";
    }
  }
};
